part of 'bloc.dart';

abstract class WebPurchaseItemPageBlocState {
  User? get user;

  WebPurchaseItemPageBlocState copyWith({
    User? Function()? user,
  });
}

class InitialWebPurchaseItemPageBlocState implements WebPurchaseItemPageBlocState {
  const InitialWebPurchaseItemPageBlocState({
    required this.user,
  });

  @override
  final User? user;

  @override
  InitialWebPurchaseItemPageBlocState copyWith({
    User? Function()? user,
  }) {
    return InitialWebPurchaseItemPageBlocState(
      user: user == null ? this.user : user(),
    );
  }
}

class LoadingWebPurchaseItemPageBlocState implements WebPurchaseItemPageBlocState {
  const LoadingWebPurchaseItemPageBlocState({
    required this.user,
  });

  @override
  final User? user;

  @override
  LoadingWebPurchaseItemPageBlocState copyWith({
    User? Function()? user,
  }) {
    return LoadingWebPurchaseItemPageBlocState(
      user: user == null ? this.user : user(),
    );
  }
}

class LoadedWebPurchaseItemPageBlocState implements WebPurchaseItemPageBlocState {
  const LoadedWebPurchaseItemPageBlocState({
    required this.user,
    required this.monthSubscriptionModel,
    required this.yearSubscriptionModel,
    required this.lifetimePurchaseItemModel,
    required this.selectedPurchaseItemSku,
    required this.purchaseRequestInProgress,
    required this.orderPlacingFailure,
  });

  @override
  final User? user;

  final MonthSubscriptionModel monthSubscriptionModel;
  final YearSubscriptionModel yearSubscriptionModel;
  final LifetimePurchaseItemModel lifetimePurchaseItemModel;
  final String selectedPurchaseItemSku;
  final bool purchaseRequestInProgress;
  final OrderPlacingFailure? orderPlacingFailure;

  @override
  LoadedWebPurchaseItemPageBlocState copyWith({
    User? Function()? user,
    MonthSubscriptionModel Function()? monthSubscriptionModel,
    YearSubscriptionModel Function()? yearSubscriptionModel,
    LifetimePurchaseItemModel Function()? lifetimePurchaseItemModel,
    String Function()? selectedPurchaseItemSku,
    bool Function()? purchaseRequestInProgress,
    OrderPlacingFailure? Function()? orderPlacingFailure,
  }) {
    return LoadedWebPurchaseItemPageBlocState(
      user: user == null ? this.user : user(),
      monthSubscriptionModel:
          monthSubscriptionModel == null ? this.monthSubscriptionModel : monthSubscriptionModel(),
      yearSubscriptionModel:
          yearSubscriptionModel == null ? this.yearSubscriptionModel : yearSubscriptionModel(),
      lifetimePurchaseItemModel: lifetimePurchaseItemModel == null
          ? this.lifetimePurchaseItemModel
          : lifetimePurchaseItemModel(),
      selectedPurchaseItemSku: selectedPurchaseItemSku == null
          ? this.selectedPurchaseItemSku
          : selectedPurchaseItemSku(),
      purchaseRequestInProgress: purchaseRequestInProgress == null
          ? this.purchaseRequestInProgress
          : purchaseRequestInProgress(),
      orderPlacingFailure:
          orderPlacingFailure == null ? this.orderPlacingFailure : orderPlacingFailure(),
    );
  }
}
